<template>
	<view class="all">
		<view class="select">
			<u-subsection :list="list" :current="curNow" @change="sectionChange" class='subsection'></u-subsection>
			<view class="com">
				<view v-if="curNow===0" class="0">
					<getorderlist></getorderlist>
				</view>
				<view v-if="curNow===1" class="1">
					<getorderlistdone></getorderlistdone>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import getorderlist from 'pages/ucenter/read-news-log/getorderlist'
	import getorderlistdone from 'pages/ucenter/read-news-log/getorderlistdone'
	export default {
		data() {
			return {
				rammend1:[],
				rammend:[],
				list: [{
						name: '正在进行'
					   },
					   {
						name: '已完成'
						},
					],
				curNow: 0,
				swiperCurrent: 0,
			}
		},
		onLoad(){
			this.getorderlist()
			this.getorderlistdone()
		},
		methods:{
			done(_id){
				// const db = uniCloud.database();
				// let collection = db.collection("uni-id-base-order")
				// let res = collection.where({_id:_id})
				//   .update({
				//    status:3,
				//   }).then((res) => {
				//         uni.showToast({
				//             title: '已收货'
				//         })
				// 		console.log(status)
				//     })
				console.log(_id)
			},
			sectionChange(index) {
							this.curNow = index;
						},
						// swiper-item左右移动，通知tabs的滑块跟随移动
			transition(e) {
							let dx = e.detail.dx;
							this.$refs.uTabs.setDx(dx);
						},
						// 由于swiper的内部机制问题，快速切换swiper不会触发dx的连续变化，需要在结束时重置状态
						// swiper滑动结束，分别设置tabs和swiper的状态
			animationfinish(e) {
							let current = e.detail.current;
							this.$refs.uTabs.setFinishCurrent(current);
							this.swiperCurrent = current;
							this.current = current;
						},
			text(){
				console.log(this.rammend1)
			},
		},
		components:{
			getorderlist,
			getorderlistdone,
			
		}
	}
</script>

<style>
	
</style>
